package socket;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.SocketAddress;

public class Client extends Thread{
    Socket socket;
    String remoteIp;
    OutputStream outputStream;
    InputStream inputStream;
    Client(Socket sock) throws IOException {
        socket=sock;
        //socketAddress代表一个没有协议附件的socket地址
        SocketAddress address=socket.getRemoteSocketAddress();//返回此套接字连接，端点地址是null则未连接
        remoteIp=address.toString();
        System.out.println("线程创建："+remoteIp+"已连接");
        inputStream=socket.getInputStream();
        outputStream=socket.getOutputStream();
    }
}
